/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controle.estatistica;

/**
 *
 * @author tytu
 */

import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import org.primefaces.event.ItemSelectEvent;
import org.primefaces.model.chart.CartesianChartModel;
import org.primefaces.model.chart.ChartSeries;

@ManagedBean
@SessionScoped
public class Categoria_Disciplina implements Serializable {

    private CartesianChartModel categoryModel;

	public Categoria_Disciplina() {
        createCategoryModel();
	}

    public CartesianChartModel getCategoryModel() {
        return categoryModel;
    }

    private void createCategoryModel() {
        categoryModel = new CartesianChartModel();

        ChartSeries geral = new ChartSeries();
        geral.setLabel("Categoria 1");

        geral.set("Disciplina 1", 120);
        geral.set("Disciplina 2", 100);
        geral.set("Disciplina 3", 44);
        geral.set("Disciplina 4", 150);
        geral.set("Disciplina 5", 25);

        ChartSeries nome = new ChartSeries();
        nome.setLabel("Categoria 2");

        nome.set("Disciplina 1", 52);
        nome.set("Disciplina 2", 60);
        nome.set("Disciplina 3", 110);
        nome.set("Disciplina 4", 135);
        nome.set("Disciplina 5", 120);

        categoryModel.addSeries(geral);
        categoryModel.addSeries(nome);
    }
    
    public void itemSelect(ItemSelectEvent event) {
        
        FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Item selected",  
                        "Item Index: " + event.getItemIndex() + ", Series Index:" + event.getSeriesIndex());  
  
        FacesContext.getCurrentInstance().addMessage(null, msg);  
    }  
    
    
    
}
                    
